﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace telefonia
{
    public partial class AddReclamo : Form
    {
        public AddReclamo()
        {
            InitializeComponent();
        }

        private void AddReclamo_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'miliData.Celular' table. You can move, or remove it, as needed.
            this.celularTableAdapter.Fill(this.miliData.Celular);

        }

        private void Agregar_Click(object sender, EventArgs e)
        {
            ReclamoModel reclamo = new ReclamoModel();
            reclamo.Codigo = cbCod.Items[cbCod.SelectedIndex].ToString();
            reclamo.Tipo = cbTipo.Items[cbTipo.SelectedIndex].ToString();
            reclamo.Fecha = dtFecha.Text.ToString();
            reclamo.Motivo = rtMotivo.Text.ToString();
            reclamo.Celular = cbCelular.SelectedIndex != -1 ? ((DataRowView)cbCelular.Items[cbCelular.SelectedIndex]).Row["numero"].ToString() : null;
            if (DataBase.AddReclamo(reclamo))
            {
                MessageBox.Show("Cliente Registrado satisfactoriamente");
            } 
        }
    }
}
